<template>
    <div>
        {{ binds }}
        <h2>修改页面</h2>
        <table>
            <tbody>
                <tr>
                    <td>商铺名称</td>
                    <td><input type="text" v-model="data.shopName"></td>
                </tr>
                <tr>
                    <td>商铺楼层</td>
                    <td><input type="text" v-model="data.hights"></td>
                </tr>
                <tr>
                    <td>商铺编号</td>
                    <td><input type="text" v-model="data.userName"></td>
                </tr>
                <tr>
                    <td>建筑面积</td>
                    <td><input type="text" v-model="data.phone"></td>
                </tr>
                <tr>
                    <td>室内面积</td>
                    <td><input type="text" v-model="data.houseMian"></td>
                </tr>
                <tr>
                    <td>租金(元/平方)</td>
                    <td><input type="text" v-model="data.pirces"></td>
                </tr>
                <tr>
                    <td>商铺状态</td>
                    <td>

                        <select v-model="data.state">
                            <option value=-1>请选择(默认显示全部)</option>
                            <option v-for="item in binds" :value="item.id">{{ item.houseState }}</option>
                        </select>


                    </td>
                </tr>
                <tr> 
                    <td>1</td>
                    <td><input type="button" value="修改" @click="update()"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">

import axios from 'axios';
import { ref,reactive, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';

const router = useRouter();

let data: any = reactive({
    id: 0,
    shopName: "",
    hights: "",
    userName: "",
    phone: "",
    houseMian: null,
    pirces: null,
    state: -1,
    strDate: "string",
    updTime: "2025-05-13T04:12:19.206Z",
    isdeteled: true
})

onMounted(() => {
    Bind();
    // Fan();
})

let binds: any = ref([])

const Bind = () => {
    axios({
        url: "/api/Hotel/Bind",
        method: "get"
    }).then((res) => {
        binds.value = res.data;
        console.log(res.data);
    })
}

const update = () => {
    //判断非空
    if(data.shopName==""){
        alert("商铺名称不能为空");
        return;
    }
    if(data.hights==""){
        alert("商铺楼层不能为空");
        return;
    }
    if(data.userName==""){
        alert("商铺编号不能为空");
        return;
    }
    if(data.phone==""){
        alert("商铺电话不能为空");
        return;
    }
    if(data.houseMian==null){
        alert("商铺室内面积不能为空");
        return;
    }
    if(data.pirces==null){
        alert("商铺租金不能为空");
        return;
    }
    if(data.state==-1){
        alert("商铺状态不能为空");
        return;
    }
    //发送请求
    axios({
        
    })
}


let query = useRoute().query;
alert(query.uid);



 


</script>

<style scoped></style>